#include <iostream>
using namespace std;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 10010;
#define ll long long
int n, m;

int a[N], b[N], c[N];
ll solve(int x, int y, int z) {
  int m = x + y * 2 + z * 5;
  rep(i, 0, m) a[i] = 0;
  a[0] = 1;
  int u[] = {x, y, z};
  int v[] = {1, 2, 5};
  rep(i, 0, 2) {
    rep(j, 0, m) b[j] = 0;
    rep(j, 0, u[i]) {
      int c = j * v[i];
      rep(k, 0, m) {
        if (k + c > m) break;
        b[k + c] += a[k];
      }
    }
    rep(j, 0, m) a[j] = b[j];
  }
  int l = 0;
  while (l <= m && a[l]) l++;
  return l;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int x, y, z;
  while (cin >> x >> y >> z && (x || y || z)) {
    cout << solve(x, y, z) << endl;
  }
  return 0;
}